package com.xunwulian.weixin.h5.service;

import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;

import java.io.IOException;
import java.util.List;

public interface CoreService {

    /**
     * HttpGet请求
     *
     * @param urlWithParams 链接
     * @throws IOException 网络异常
     */
    void requestGet(String urlWithParams) throws IOException;

    /**
     * HttpPost请求
     *
     * @param url    地址
     * @param params 参数
     * @throws ClientProtocolException 异常
     * @throws IOException             异常
     */
    void requestPost(String url, List<NameValuePair> params) throws ClientProtocolException, IOException;

    /**
     * 刷新消息路由器
     */
    void refreshRouter();

    /**
     * 路由消息
     *
     * @param inMessage 下行消息
     * @return 消息
     */
    WxMpXmlOutMessage route(WxMpXmlMessage inMessage);

    /**
     * 通过openid获得基本用户信息
     *
     * @param openid 微信ID
     * @param lang   语言
     * @return
     */
    WxMpUser getUserInfo(String openid, String lang);

}
